from django.db import models
from datetime import datetime
# Create your models here.



class Classes(models.Model):
    name = models.CharField(max_length=20, verbose_name="班级")
    # manger_teacher = models.ForeignKey(Teachers)


class Teachers(models.Model):

    teacher_name = models.CharField(max_length=20, verbose_name="教师名")
    # teacher_phone = models.CharField(max_length)
    classes = models.ManyToManyField(Classes, verbose_name="所属班级")


class Student(models.Model):
    SEX_CHOICES = ((1, '男'), (2, '女'))

    name = models.CharField(max_length=20, verbose_name="姓名")
    age = models.IntegerField(null=True, blank=True, verbose_name="年龄")
    sex = models.IntegerField(choices=SEX_CHOICES, default=1, verbose_name="性别")
    address = models.CharField(max_length=80, verbose_name="地址", null=True)
    email = models.EmailField(verbose_name="邮箱", null=True)
    classes = models.ForeignKey(Classes, on_delete=models.SET_NULL, null=True, verbose_name="班级")


class StuApplication(models.Model):

    application_choice = ((0, "班级申请"), (1, "简历申请"))
    student = models.ForeignKey(Student, on_delete=models.CASCADE)
    application_time = models.TimeField(default=datetime.now(), verbose_name="创建时间")
    application_classes = models.IntegerField(choices=application_choice, default=0, verbose_name="申请类型")
    application_Text = models.TextField()


class Student1(models.Model):
    pass
